package cn.tedu.hospitalqd.service.impl;

import cn.tedu.hospitalqd.ex.ServiceException;
import cn.tedu.hospitalqd.mapper.RegistrationMapper;
import cn.tedu.hospitalqd.pojo.dto.RegistrationAddNewDTO;
import cn.tedu.hospitalqd.pojo.dto.RegistrationUpdateDTO;
import cn.tedu.hospitalqd.pojo.dto.ZhenliaoUpdateDTO;
import cn.tedu.hospitalqd.pojo.entity.Registration;
import cn.tedu.hospitalqd.pojo.entity.Zhenliao;
import cn.tedu.hospitalqd.pojo.vo.RegistrationListItemVO;
import cn.tedu.hospitalqd.pojo.vo.RegistrationStandardVO;
import cn.tedu.hospitalqd.pojo.vo.ZhenliaoListItemVO;
import cn.tedu.hospitalqd.pojo.vo.ZhenliaoStandarVO;
import cn.tedu.hospitalqd.service.RegistrationService;
import cn.tedu.hospitalqd.web.ServiceCode;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RegistrationServiceImpl implements RegistrationService {

    @Autowired
    private RegistrationMapper registrationMapper;

    public void addNew(RegistrationAddNewDTO registrationAddNewDTO){
        String name = registrationAddNewDTO.getSName();
        int countByName = registrationMapper.selectCount();
        if (countByName > 0){
            String message = "";
            throw new ServiceException(ServiceCode.ERR_CONFLICT,message);
        }

        Registration registration = new Registration();
        BeanUtils.copyProperties(registrationAddNewDTO,registration);
        registrationMapper.insert(registration);
    }

    @Override
    public void delete(Long id) {

    }

    @Override
    public void updateInfoById(Long id, RegistrationUpdateDTO registrationUpdateDTO) {

    }

    @Override
    public RegistrationStandardVO getStandardById(Long id) {
        return null;
    }

    @Override
    public List<RegistrationListItemVO> list() {
        return null;
    }


}
